package com.gewu.pm.ui.fragment.sales;

import android.widget.ImageView;
import android.widget.TextView;

import com.gewu.pm.R;
import com.gewu.pm.app.AppFragment;

/**
 * 销售线索详情 Fragment
 */
public final class SalesLeadDetailFragment extends AppFragment<com.gewu.pm.app.AppActivity> {

    // 基本信息
    private TextView mLeadNameInfoView;
    private TextView mLeadCodeInfoView;
    private TextView mSalesAreaInfoView;
    private TextView mLeadTypeInfoView;
    private ImageView mFacadePhotoView;
    private ImageView mStorePhotoView;

    // 系统信息
    private TextView mCreateTimeView;
    private TextView mCreatorView;
    private TextView mModifyTimeView;
    private TextView mModifierView;

    // 地区信息
    private TextView mLocationAreaView;
    private TextView mDetailedAddressView;
    private TextView mLatLngView;

    public static SalesLeadDetailFragment newInstance() {
        return new SalesLeadDetailFragment();
    }

    @Override
    protected int getLayoutId() {
        return R.layout.sales_lead_detail_fragment;
    }

    @Override
    protected void initView() {
        // 基本信息
        mLeadNameInfoView = findViewById(R.id.tv_lead_name_info);
        mLeadCodeInfoView = findViewById(R.id.tv_lead_code_info);
        mSalesAreaInfoView = findViewById(R.id.tv_sales_area_info);
        mLeadTypeInfoView = findViewById(R.id.tv_lead_type_info);
        mFacadePhotoView = findViewById(R.id.iv_facade_photo);
        mStorePhotoView = findViewById(R.id.iv_store_photo);

        // 系统信息
        mCreateTimeView = findViewById(R.id.tv_create_time);
        mCreatorView = findViewById(R.id.tv_creator);
        mModifyTimeView = findViewById(R.id.tv_modify_time);
        mModifierView = findViewById(R.id.tv_modifier);

        // 地区信息
        mLocationAreaView = findViewById(R.id.tv_location_area);
        mDetailedAddressView = findViewById(R.id.tv_detailed_address);
        mLatLngView = findViewById(R.id.tv_lat_lng);
    }

    @Override
    protected void initData() {
        // TODO: 加载详情数据，这里先使用布局中的测试数据
    }

    /**
     * 更新详情数据
     * 
     * @param leadName 线索名称
     * @param leadCode 线索编码
     * @param salesArea 销售区域
     * @param leadType 线索类型
     */
    public void updateData(String leadName, String leadCode, String salesArea, String leadType) {
        // 布局中已拆分标签和内容，这里只需要设置内容部分
        mLeadNameInfoView.setText(leadName);
        mLeadCodeInfoView.setText(leadCode);
        mSalesAreaInfoView.setText(salesArea);
        mLeadTypeInfoView.setText(leadType);
    }
}

